home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / perl / dosperl.zoo / gdbm.h < prev    next >
C/C++ Source or Header  |  1991-08-18  |  3KB  |  93 lines

  1. /* gdbm.h  -  The include file for dbm users.  */
  2.  
  3. /*  This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
  4.     Copyright (C) 1990  Free Software Foundation, Inc.
  5.  
  6.     GDBM is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 1, or (at your option)
  9.     any later version.
  10.  
  11.     GDBM is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with GDBM; see the file COPYING.  If not, write to
  18.     the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.     You may contact the author by:
  21.        e-mail:  phil@wwu.edu
  22.       us-mail:  Philip A. Nelson
  23.                 Computer Science Department
  24.                 Western Washington University
  25.                 Bellingham, WA 98226
  26.         phone:  (206) 676-3035
  27.        
  28. *************************************************************************/
  29.  
  30. /* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
  31.    can create the database. */
  32. #define  GDBM_READER  0        /* A reader. */
  33. #define  GDBM_WRITER  1        /* A writer. */
  34. #define  GDBM_WRCREAT 2        /* A writer.  Create the db if needed. */
  35. #define  GDBM_NEWDB   3        /* A writer.  Always create a new db. */
  36.  
  37. /* Parameters to gdbm_store for simple insertion or replacement in the
  38.    case that the key is already in the database. */
  39. #define  GDBM_INSERT  0        /* Never replace old data with new. */
  40. #define  GDBM_REPLACE 1        /* Always replace old data with new. */
  41.  
  42.  
  43. /* The data and key structure.  This structure is defined for compatibility. */
  44. typedef struct {
  45.     char *dptr;
  46.     int   dsize;
  47.       } datum;
  48.  
  49.  
  50. /* The file information header. This is good enough for most applications. */
  51. typedef struct {int dummy[10];} *GDBM_FILE;
  52.  
  53.  
  54. /* These are the routines! */
  55.  
  56. extern GDBM_FILE gdbm_open ();
  57.  
  58. extern void     gdbm_close ();
  59.  
  60. extern datum     gdbm_fetch ();
  61.  
  62. extern int     gdbm_store ();
  63.  
  64. extern int     gdbm_delete ();
  65.  
  66. extern datum     gdbm_firstkey ();
  67.  
  68. extern datum     gdbm_nextkey ();
  69.  
  70. extern int     gdbm_reorganize ();
  71.  
  72.  
  73. /* gdbm sends back the following error codes in the variable gdbm_errno. */
  74. typedef enum {    GDBM_NO_ERROR,
  75.         GDBM_MALLOC_ERROR,
  76.         GDBM_BLOCK_SIZE_ERROR,
  77.         GDBM_FILE_OPEN_ERROR,
  78.         GDBM_FILE_WRITE_ERROR,
  79.         GDBM_FILE_SEEK_ERROR,
  80.         GDBM_FILE_READ_ERROR,
  81.         GDBM_BAD_MAGIC_NUMBER,
  82.         GDBM_EMPTY_DATABASE,
  83.         GDBM_CANT_BE_READER,
  84.             GDBM_CANT_BE_WRITER,
  85.         GDBM_READER_CANT_DELETE,
  86.         GDBM_READER_CANT_STORE,
  87.         GDBM_READER_CANT_REORGANIZE,
  88.         GDBM_UNKNOWN_UPDATE,
  89.         GDBM_ITEM_NOT_FOUND,
  90.         GDBM_REORGANIZE_FAILED,
  91.         GDBM_CANNOT_REPLACE}
  92.     gdbm_error;
  93.